
import os
def get_size(dir1):
    dlist=os.listdir(dir1)
    for i in dlist:
        path = os.path.join(dir1, i)
        if os.path.isfile(path):
            return os.path.getsize(path)
        if os.path.isdir(path):
            return get_size(path)
print('该文件大小为{}字节'.format(get_size(r'C:\Users\27745\Desktop\untitled333\venv\Scripts')))



